package Local.Date.Time;

import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;

public class DateTime {
    public void example() {
        System.out.println("--------------分界1----------------");

        LocalDateTime time_now = LocalDateTime.now();
        LocalDateTime first_day_of_month = time_now.with(TemporalAdjusters.firstDayOfMonth());
        LocalDateTime last_day_of_year = time_now.with(TemporalAdjusters.lastDayOfYear());

        System.out.println(first_day_of_month);
        System.out.println(last_day_of_year);

        System.out.println("--------------分界2----------------");

        LocalDateTime example_time = LocalDateTime.of(2025,3,29,12,24);
        LocalDateTime plus_month = example_time.plusMonths(1);
        LocalDateTime minus_hour = example_time.minusHours(3);

        System.out.println(plus_month);
        System.out.println(minus_hour);

        System.out.println("--------------分界3----------------");

        System.out.println("当前时间：" + time_now);
        System.out.println("当前星期：" + time_now.getDayOfWeek().getValue());
        System.out.println("当前月份：" + time_now.getMonth());
        System.out.println("当前月份：" + time_now.getMonthValue());
    }
}
